﻿namespace Library.OrmEnterpriseEntity.Factor {
	/// <summary>
	/// PersistentEntity context
	/// </summary>
  public interface IServiceContext {
		/// <summary>
		/// Current row type per thread
		/// </summary>
		short CurrentRowType { get; set; }
		/// <summary>
		/// Perform insert entity action
		/// </summary>
		/// <param name="entity"></param>
		/// <returns>true: insert successfully otherwise false</returns>
  	bool DoInsert(GlobalEntity entity);
		/// <summary>
		/// Perform update entity action
		/// </summary>
		/// <param name="entity"></param>
		/// <returns>true: update successfully otherwise false</returns>
  	bool DoUpdate(GlobalEntity entity);
		/// <summary>
		/// Perform delete entity action
		/// </summary>
		/// <param name="entity"></param>
		/// <returns>true: delete successfully otherwise false</returns>
  	bool DoDelete(GlobalEntity entity);
		/// <summary>
		/// Build sql wildcard from window wildcard. Window wildcard: * mean all chars, ? mean one any char
		/// </summary>
		/// <param name="windowWildCard"></param>
		/// <returns></returns>
  	string BuildSqlWildcard(string windowWildCard);
  }
}
